//封装promise方法的微信请求

export default function request(option){
  
  wx.showLoading({
    title: '数据加载中',
  })
  let baseURL = "http://192.168.0.106:8090/xzhotel/";
  let token = wx.getStorageSync('_token');
  console.log(token);
  return new Promise((resolve,reject) =>{
    
    wx.request({
      url: baseURL+option.url,
      header: { 
        '__token': token,
        },
      method:option.method||'post',
      data:option.data||{},
      success:resolve,
      fail:reject,
      complete: res => {
          wx.hideLoading()
      
      }
    })
  })
}



